package parseAndHandleTool;

import com.oocl.crm_system.Customer;
import com.oocl.crm_system.DoublyList;

public class ParseCmdForAdd extends ParseCmd{
	public void parseCmdForAdd(DoublyList<Customer> list,String inputByConsole){
		String input = inputByConsole;
		input = input.substring(2);
		
		String[] buf = input.split(",");
		String[] buf1 = new String[2];
		String[] buf2 = new String[buf.length];          //get the value from input 
		
		for(int i = 0; i < buf.length; i++){
			buf1 = buf[i].split(":");
			buf2[i] = buf1[1];
		}
		
		//change id = '123' to id = 123
		Customer customer = new Customer(Integer.parseInt(buf2[0]),buf2[1],buf2[2],buf2[3],buf2[4],buf2[5]);
		list.insertTail(customer);
	}
}
